const { next } = require("cli")
const express = require("express")

const app = express()

let layersNum = 100

const fibo = (n) => {
  if (n < 2) {
    return 1
  }
  return fibo(n-1) + fibo(n-2)
}

const route = express.Router()

route.get("/test", (req, res) => {
  res.send("OK")
})

app.use("/often", route)


for (let i = 0; i < layersNum; i++) {
  app.get("layer" + i, (req, res) => {
    res.send(i)
  })
}

for (let i = 0; i < 10; i++) {
  app.use((req, res, next) => {
    fibo(10)
    next()
  })
}

app.get("/test", (req, res) => {
  res.send("ok")
})


app.listen(3002, () => {
  console.log("The server is running at port 3002")
})